Added --include flag to buildah add and buildah copy - #6988
Open
ajoshua2004 wants to merge 1 commit into
Open
Conversation
|
Ephemeral COPR build failed. @containers/packit-build please check. |
| // Matches uses filepath.FromSlash() to convert candidates before | ||
| // checking if they match the patterns it's been given, implying that | ||
| // it expects Unix-style paths. | ||
| matches, err := pm.Matches(filepath.ToSlash(rel)) //nolint:staticcheck |
Contributor
There was a problem hiding this comment.
IDK, and I don't think it's an issue, but will ask. Do we have to worry about a symbolic link here? If someone set up a symbolic link to /etc/passwd or what have you, and the link was put in the include option, would it suck in the passwd info to the container? Mostly concerning in a rootless environment.
Contributor
Author
There was a problem hiding this comment.
links are handled in the same way as excludes so I don't believe we'd have to worry about links.
ajoshua2004
force-pushed
the
include
branch
2 times, most recently
from
July 24, 2026 14:51
2802cf0 to
dd88ebb
Compare
Contributor
Author
|
@podman-container-tools/buildah-maintainers |
nalind
reviewed
Jul 28, 2026
| run_buildah_umount $cid | ||
| expect_output --from="$filelist" "$expect" "add recursive include" | ||
|
|
||
| # else arm: a single named file that matches include copies cleanly |
Contributor
There was a problem hiding this comment.
Not sure what the first part of this comment means.
Complement to existing --exclude flag. When specified, only files matching the given patterns are copied. Uses the same containerignore(5) pattern format. Can be combined with --exclude, where exclude takes priority. Signed-off-by: Joshua Arrevillaga <2004jarevillaga@gmail.com>
Contributor
Author
|
PTAL @podman-container-tools/buildah-maintainers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
What this PR does / why we need it:
Adds an
--includeflag to both add and copy cli commands. This is the complement to--exclude.Its purpose is to only copy files with the corresponding pattern. Excludes will take priority when both match
This feature is not usable in Dockerfiles and Containerfiles
How to verify it
bats --filter "add --include" tests/add.batsbats --filter "copy --include" tests/copy.batsWhich issue(s) this PR fixes:
Part of #6732
Special notes for your reviewer:
This is the precursor to the RequiredPaths flag that will be incoming.
Does this PR introduce a user-facing change?